package com.wen.util;

/**
 * @Description:
 * @Author: wenxin
 * @Date: 2022/6/23 16:51
 * @Version: 1.0
 */
public class NetStatUtil {
    public static String[] getNetStatList(String line){
        StringBuffer s=new StringBuffer(line);
        while (s.indexOf("  ")>=0){
            s.replace(s.indexOf("  "),s.indexOf("  ")+2," ");
        }
        line=s.toString();
        String[] a=line.split(" ");
        String[] b=new String[5];
        for (int i=0;i<a.length;i++){
            if("UDP".equals(b[0])&&i>=a.length-2){
                if(i>=a.length-1){
                    b[i]=a[i];
                }
            }else if(i<a.length-1){
                b[i]=a[i+1];
            }
        }
        return b;
    }
}
